package com.jarvis.dubbo.utils;

import com.jarvis.dubbo.pojo.User;

/**
 * TODO XXX
 *
 * @author liangjw
 * created in 2020/9/18
 */
public class UserHolder {
    private static final ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static User getCurrentUser(){
        return threadLocal.get();
    }
    public static void setCurrentUser(User user){
        threadLocal.set(user);
    }

    public static void clear(){
        threadLocal.remove();
    }
}
